<div id="auditModal" class="modal fade" tabindex="-1" data-width="400">
	<div class="modal-dialog" style="width:800px">
		<div class="modal-content">

			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title">申请记录</h4>
			</div>
			<table class="table table-striped table-hover noborder" style="margin: 0px;word-break:break-all; word-wrap:break-all;">
				<thead>
				<colgroup>
					<col width='50px'>
					<col width='110px'>
					<col width='160px'>
					<col>
					<col width='120px'>
					<col width='160px'>
					<col width='70px'>
				</colgroup>
				<tr>
					<td>序号</td>
					<td>类型</td>
					<td>申请时间</td>
					<td>用途</td>
					<td>审核状态</td>
					<td>审核时间</td>
					<td>详情</td>
				</tr>
				</thead>

				<tbody id="auditListTbody">
					<tr>
						<td colspan=7 class='text-center'>暂无数据</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>
<div id="auditDetailModal" class="modal fade" tabindex="-1" data-width="400" style="z-index:2000;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
				<h4 class="modal-title"><span id="auditDetailAction"></span></h4>
			</div>
			<form class="form-horizontal form-bordered form-row-stripped" id="auditDetailForm">
			</form>
			<div class="modal-footer" id="cancelDiv" style="display:none">
				<button type="button" data-dismiss="modal" class="btn" >取消</button>
				<button type="button" id="cancelBtn" class="btn btn-primary" onclick="cancelAudit()">撤销</button>
			</div>
		</div>
	</div>
</div>
<script>
	function showAuditList(){
		$.get('${request.contextPath}/audit/list',
	        function(data){
				$("#auditListTbody").html(data);
				$("#auditModal").modal('show');
	       	}
		);
	}
	function auditDetail(aid, type, action, cancel){
		$("#auditDetailAction").html(action);
		$("#auditDetailForm").html("");
		$.get('${request.contextPath}/audit/detail',
			{
				aid: aid,
				type: type
			},function(data){
				$("#auditDetailForm").html(data);
				$("#auditDetailModal").modal('show');
				if(cancel){
					$("#cancelDiv").show();
					$("#cancelBtn").attr("data", aid);
				} else {
					$("#cancelDiv").hide();
				}
	       	}
		);
	}
	function cancelAudit(){
		disable("cancelBtn");
		$.get('${request.contextPath}/audit/cancel',
			{
				aid: $("#cancelBtn").attr("data")
			},function(data){
				if(data.status == 200){
					toastr.success("撤消成功");
					enable("cancelBtn");
					modalHide(3000);
			    }else{
			    	toastr.error("撤消失败！"+data.message);  
			    	enable("cancelBtn");
			    }
	       	}
		);
	}
</script>